/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Tipo_Infraestructura_Fisica")
@NamedQueries({
    @NamedQuery(name = "TipoInfraestructuraFisica.findAll", query = "SELECT t FROM TipoInfraestructuraFisica t"),
    @NamedQuery(name = "TipoInfraestructuraFisica.findByIdTipoInfraestructura", query = "SELECT t FROM TipoInfraestructuraFisica t WHERE t.idTipoInfraestructura = :idTipoInfraestructura"),
    @NamedQuery(name = "TipoInfraestructuraFisica.findByNombre", query = "SELECT t FROM TipoInfraestructuraFisica t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "TipoInfraestructuraFisica.findByEstado", query = "SELECT t FROM TipoInfraestructuraFisica t WHERE t.estado = :estado")})
public class TipoInfraestructuraFisica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdTipoInfraestructura")
    private Integer idTipoInfraestructura;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoInfraestructura", fetch = FetchType.LAZY)
    private List<InfraestructuraFisica> infraestructuraFisicaList;

    public TipoInfraestructuraFisica() {
    }

    public TipoInfraestructuraFisica(Integer idTipoInfraestructura) {
        this.idTipoInfraestructura = idTipoInfraestructura;
    }

    public Integer getIdTipoInfraestructura() {
        return idTipoInfraestructura;
    }

    public void setIdTipoInfraestructura(Integer idTipoInfraestructura) {
        this.idTipoInfraestructura = idTipoInfraestructura;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<InfraestructuraFisica> getInfraestructuraFisicaList() {
        return infraestructuraFisicaList;
    }

    public void setInfraestructuraFisicaList(List<InfraestructuraFisica> infraestructuraFisicaList) {
        this.infraestructuraFisicaList = infraestructuraFisicaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoInfraestructura != null ? idTipoInfraestructura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoInfraestructuraFisica)) {
            return false;
        }
        TipoInfraestructuraFisica other = (TipoInfraestructuraFisica) object;
        if ((this.idTipoInfraestructura == null && other.idTipoInfraestructura != null) || (this.idTipoInfraestructura != null && !this.idTipoInfraestructura.equals(other.idTipoInfraestructura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.TipoInfraestructuraFisica[ idTipoInfraestructura=" + idTipoInfraestructura + " ]";
    }
    
}
